package com.cjack.frenchexcel.config;


public class PrivateConfig {

    public final static String SUPER_ADMIN_CODE = "LEVEL_SUPER";//系统里面超级管理员的角色code
    public final static String FIRST_ADMIN_CODE = "LEVEL_ADMIN";//一级管理员的code
    public final static String SECOND_ADMIN_CODE = "LEVEL_ADMIN";//二级管理员的code
    public final static String EMPLOEE_CODE = "LEVEL_EMPLOY";//员工的code
    public final static String ALL = "_ALL_";//所有权限

    //权限相关
    public static String RECHARGE_LIST = "recharge_list";//查看自己的充值记录
    public static String RECHARGE_LIST_ALL = "recharge_list_all";//查看所有的充值记录
    public static String RECHARGE_EXCEL = "recharge_excel";//上传充值记录
    public static String RECHARGE_EDIT_STATUS = "recharge_edit_status";//设置充值到帐状态

    public static String CONSUMER_LIST = "consumer_list";//查看自己的消费记录
    public static String CONSUMER_LIST_ALL = "consumer_list_all";//查看所有的消费记录
    public static String CONSUMER_EXCEL = "consumer_excel";//上传消费记录
    public static String INVOICE_REVIEW = "invoice_review";//审核发票

    public static String GOODS_LIST = "goods_list";//查看自己的商品列表
    public static String GOODS_EDIT_STATUS = "goods_edit_status";//设置商品出关单状态
    public static String SEND_GOODS_LIST = "send_goods_list";//商品发货管理
    public static String GOODS_LIST_ALL = "goods_list_all";//查看所有的商品列表


    public static String DATADEFINE_LIST = "datadefine_list";//数据项配置 全息
    public static String SYSTEM_RECORD = "systemRecord_list";//系统备份
    public static String ROLE_LIST = "roleAdmin_list";//角色列表

    public static String ADMINUSER_LIST = "userAdmin_list";//员工列表
    public static String ADMINUSER_REVIEW = "userAdmin_review";//员工审核

    public static String SUMMARY_LIST = "summary_list";//员工数据汇总

    public static String INDEX_DATA = "index_data";//首页数据
    /**
     * 把字符串数组拼接成逗号分割的字符串
     * @param arr
     * @return
     */
    private static String handleString( String[] arr){
        StringBuilder sb = new StringBuilder();
        for( String str : arr){
            sb.append( str).append( ",");
        }
        return sb.toString();
    }

    /**
     *
     * @param roleContent
     * @param name
     * @return  true 代表有权限，false代表无权限
     */
    public static boolean checkPrivalege( String roleContent, String name){
        if( roleContent.equals( ALL) || roleContent.indexOf( name) != -1){
            return true;
        }
        return false;
    }
}
